package com.hxzy.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hxzy.common.dto.PageDTO;
import com.hxzy.common.service.impl.BaseServiceImpl;
import com.hxzy.common.vo.PageResultVO;
import com.hxzy.entity.Role;
import com.hxzy.mapper.RoleMapper;
import com.hxzy.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class RoleServiceImpl  extends BaseServiceImpl<Role,Integer>  implements RoleService {

    private RoleMapper  roleMapper;

    @Autowired
    public void setRoleMapper(RoleMapper roleMapper) {
        this.roleMapper = roleMapper;
        super.setMyBatisBaseDao(roleMapper);
    }


    @Override
    public PageResultVO search( PageDTO pageDTO) {
        PageHelper.startPage(pageDTO.getPage(),pageDTO.getSize());
        List<Role> arrList=this.roleMapper.search(pageDTO);
        Page pg= (Page) arrList;
        return new PageResultVO(pg);
    }
}
